<template>
	<div class="wdxq2 xxtz" :style="{'min-height':Height-73+'px'}">
		<div class="wdxq_title flex align_center">
			<i class="el-icon-arrow-left" style="float: left;margin-left: 4%;font-size: 2.4rem;" @click="fh"></i>
			<span class="flex1">消息通知设置</span>
			<i class="el-icon-arrow-left" style="float: right;margin-right: 4%;font-size: 2.4rem;opacity: 0;"></i>
		</div>
		<div class="wdxq_div13 clear2" style="padding: 1.5rem 0;">
			<div class="wdxq_div13d">
				<el-radio v-model="list.notice_set" label="1" >接受全部</el-radio>
			</div>
			<div class="wdxq_div13d">
				<el-radio v-model="list.notice_set" label="2" >只接受筛选</el-radio>
			</div>
			<div class="wdxq_div13d">
				<el-radio v-model="list.notice_set" label="3" >只接受关注</el-radio>
			</div>
  		</div>
  		<div class="wdxq_div3 clear2">
			<div class="wdxq_div3left flex align_center">
				接受新消息通知 
			</div>
			<div class="xxtz_right">
				<el-switch
				  v-model="list.is_news_notice"
				  active-color="#409EFF"
				  inactive-color="#EBEEF5"
				  active-value="1"
				  inactive-value="0">
				</el-switch>
			</div>
		</div>
		<div class="wdxq_div3 clear2">
			<div class="wdxq_div3left flex align_center">
				接受点赞消息通知 
			</div>
			<div  class="xxtz_right">
				<el-switch
				  v-model="list.is_good_notice"
				  active-color="#409EFF"
				  inactive-color="#EBEEF5"
				  active-value="1"
				  inactive-value="0">
				</el-switch>
			</div>
		</div>
		<div class="wdxq_div3 clear2">
			<div class="wdxq_div3left flex align_center">
				接受评论消息通知 
			</div>
			<div class="xxtz_right">
				<el-switch
				  v-model="list.is_comment_notice"
				  active-color="#409EFF"
				  inactive-color="#EBEEF5"
				  active-value="1"
				  inactive-value="0">
				</el-switch>
			</div>
		</div>
		<div class="wdxq_div3 clear2">
			<div class="wdxq_div3left flex align_center">
				被关注消息通知 
			</div>
			<div class="xxtz_right">
				<el-switch
				  v-model="list.is_like_notice"
				  active-color="#409EFF"
				  inactive-color="#EBEEF5"
				  active-value="1"
				  inactive-value="0">
				</el-switch>
			</div>
		</div>
		<div class="wdxq_div3 clear2">
			<div class="wdxq_div3left flex align_center">
				开启夜间免打扰 
			</div>
			<div class="xxtz_right">
				<el-switch
				  v-model="list.is_disturb_notice"
				  active-color="#409EFF"
				  inactive-color="#EBEEF5"
				  active-value="1"
				  inactive-value="0">
				</el-switch>
			</div>
		</div>
		<p style="line-height: 2rem;font-size: 1.2rem;color: #505050;width: 94%;margin: 0 auto;">开启夜间勿扰选项，23:00-8:00不推送</p>

	</div>
</template>

<script>
	export default {
		data: function() {
			return {
				value2:true,
				radio:'1',
				Height:0,
				tabI:0,
				div1left:[{
					'name':'本月',
					'i':0,
				},{
					'name':'上月',
					'i':1,
				},{
					'name':'全部',
					'i':2,
				}],
				list:{},
				listshow:false,

			}
		},
		watch:{
			list: {
		      handler: function (newVal) {
		        this.setUserNotice(newVal)
		      },
		      deep: true
		    }
			
			
			
		},
		mounted() {
			this.Height=document.body.offsetHeight;
			this.getUserNotice();
		},
		methods: {
			setUserNotice(val){
				if(!this.listshow){
					return false;
				}
				val.uid=window.uid;
				this.$http.post(this.defines.setUserNotice, val, {
						emulateJSON: true
					})
					.then(
						(data) => {
							console.log(data)
							
						},
						(error) => {
							console.log(error);
						}
					);
			},
			fh(){
        		window.history.go(-1);
        	},
        	getUserNotice(){
        		let  loading=this.$loading({
		          lock: true,
		          text: 'Loading',
		          spinner: 'el-icon-loading',
		          background: 'rgba(255, 255, 255, 1)'
		        });
				this.$http.post(this.defines.getUserNotice, {
						uid: window.uid
					}, {
						emulateJSON: true
					})
					.then(
						(data) => {
							this.list=data.data.data;
							this.listshow=true;
							loading.close();
						},
						(error) => {
							console.log(error);
						}
					);
        	},
		}
	}
</script>
<style scoped="scoped">
	.xxtz_right{
		float: right;line-height: 3.5rem;
	}
</style>
<style>
	.xxtz .el-switch__core{
		border-color: #DCDFE6 !important;
	}
	.xxtz .el-radio__input.is-checked .el-radio__inner{
		border-color: #409EFF !important;	
		background: #409EFF !important;	
		box-shadow: 0px 0px 0px 0px !important;
	}
	.xxtz .el-radio__input.is-checked+.el-radio__label{
		color: #409EFF;	
	}
	.xxtz .el-radio__inner:hover{
		border-color: #409EFF !important;	
		background: #409EFF !important;	
	}
	.xxtz .el-radio__label{
		font-size: 1.4rem;
	}
</style>
